﻿Option Strict On
Option Explicit On
Option Infer On

Imports System
Imports System.Linq
Imports System.Collections.Generic
Imports GenDotNet.Task.Common

Public Class NamespaceInfo
   Inherits BaseInfo

   Private mContents As EmptyDelegate

   Public Sub New(ByVal del As EmptyDelegate)
      Me.New(Nothing, del)
   End Sub

   Public Sub New(ByVal name As String, ByVal del As EmptyDelegate)
      MyBase.New(name, Scope.Unknown)
      If String.IsNullOrEmpty(Me.Name) Then
         Me.Name = del.Method.Name.SpaceAtCaps
      End If
      Me.mContents = del
   End Sub

   Public ReadOnly Property ContentDelegate() As EmptyDelegate
      Get
         Return mContents
      End Get
   End Property

End Class

Namespace VB
   Public Module NamespaceInfoExtensions
      <Runtime.CompilerServices.Extension()> _
      Public Function Output(ByVal info As NamespaceInfo) As String
         Return _
   <code>
Namespace <%= info.Name %><%= Strings.nl %>
      <%= info.ContentDelegate.Invoke() %>
End Namespace
</code>.Value
      End Function
   End Module
End Namespace

Namespace CSharp
   Public Module NamespaceInfoExtensions
      <Runtime.CompilerServices.Extension()> _
      Public Function Output(ByVal info As NamespaceInfo) As String
         Return _
   <code>
namespace <%= info.Name %>
{
      <%= info.ContentDelegate.Invoke() %>
}
</code>.Value
      End Function
   End Module
End Namespace